CFLAGS=-Wall -O2 -IParser --std=gnu99 -DPGEN -DWITHOUT_COMPLEX

LIBPARSER=Parser/tokenizer.o Parser/parsetok.o Parser/parser.o Parser/node.o Parser/acceler.o Parser/grammar1.o Parser/graminit.o Parser/pythonvoid.o Parser/ast.o Parser/Python-ast.o Parser/asdl.o pyparser.o
LIBS=libpyparser.a
EXES=niam
OBJECTS=niam.o $(LIBPARSER)

all: $(EXES)

.PHONY: test
#test: $(EXES)
#	cd test && python test.py

# Include dependency information for all .c files
include $(OBJECTS:.o=.d) 

niam: niam.o libpyparser.a

libpyparser.a: $(LIBPARSER)
	$(AR) rcs $@ $^

clean:
	$(RM) $(EXES)
	$(RM) $(LIBS)
	$(RM) $(OBJECTS)
	$(RM) $(OBJECTS:.o=.d)

# Make the dependency recomputation silent
%.d: %.c
	@./depend.sh `dirname $*.c` $*.c $(CFLAGS) > $@
